<template>
	<view class="">
		<u-sticky>
			<view class="row top-con">
				<view class="row-item flex2 r-title">昵称</view>
				<view class="row-item flex2 r-title">消费金额</view>
				<view class="row-item flex3 r-title">收益金额</view>
				<view class="row-item flex3 r-title">到账时间</view>
			</view>
		</u-sticky>
		<s-pull-scroll ref="pullScroll" :pullDown="pullDown" :pullUp="loadData" :back-top="true" :headerHeight="44" :footerHeight="40">
			<view class="item-swiper">
				<view class="item row" v-for="(item, index) in dataList" :key="index">
					<view class="row-item flex2 item-name clamp">{{item.nickName}}</view>
					<view class="row-item flex2 item-name">{{item.money}}</view>
					<view class="row-item flex3 item-name">{{item.commission}}</view>
					<view class="row-item flex3 item-name">{{item.receiveTime | YMD}}</view>
				</view>
			</view>
		</s-pull-scroll>
		<mix-loading v-if="isLoading"></mix-loading>
	</view>
</template>

<script>
export default {
	data() {
		return {
			dataList: []
		};
	},
	onLoad() {
		this.refresh();
	},
	methods: {
		pullDown(pullScroll) {
			setTimeout(() => {
				this.loadData(pullScroll);
			}, 200);
		},
		async loadData(pullScroll) {
			const data = {
				uid:uni.getStorageSync('uid'),
				pageNo:pullScroll.page,
				pageSize:'20'
			};
			const res = await this.$request('tz/commission-list', data, { showLoading: true });
			if (pullScroll.page == 1) this.dataList = [];
			if (res.result == 0) {
				this.dataList = this.dataList.concat(res.data.list);
				pullScroll.endByPage(Math.ceil(res.data.count / 20), res.data.list);
			} else {
				this.$util.msg(res.resultNote);
			}
		}
	}
};
</script>

<style scoped>
.top-con {
	height: 88upx;
	background: #f6f6f6;
	padding: 0 20upx;
}
.row-item {
	text-align: center;
}
.flex2 {
	flex: 2;
}
.flex3 {
	flex: 3;
}
.item-swiper {
	padding: 20upx;
}
.item {
	height:66upx;
}
.item-name {
	font-size: 26upx;
	color: #333333;
}
.r-title {
	font-size: 24upx;
	color: #666666;
}
</style>
